package com.njit.farm.controller;

import com.njit.farm.model.Integral;
import com.njit.farm.model.Result;
import com.njit.farm.service.IntegralService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/integral/")
public class IntegralController {

    @Resource
    IntegralService integralService;

    @RequestMapping(value = "add",method = RequestMethod.POST)
    public Result add(@RequestBody Integral integral){

        return integralService.add(integral);
    }

    @RequestMapping(value = "getByUserId", method = RequestMethod.GET)
    public Result getByUserId(@RequestParam("uId") String uId) {
        return integralService.queryByUserId(uId);
    }
}
